<!DOCTYPE html>
<html>

<head>
    <include file="public@head" title="注册用户-用户列表"/>
</head>

<body class="layui-layout-admin">
<include file="public@header"/>
<include file="public@side"/>
<div class="layui-body">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a href="{:url('admin/index/index')}">主页</a>
        <a href="{:url('admin/user/index')}">用户管理</a>
        <a><cite>注册用户</cite></a>
    </div>
    <div class="layui-fluid pdt10">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="listsTable layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">手机号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="mobile" placeholder="手机号" autocomplete="on" class="layui-input">
                        </div>
                        <button class="layui-btn" data-type="reload">筛选</button>
                    </div>
                </div>

                <table class="layui-hide table-center" id="lists" lay-filter="lists"></table>

                <script type="text/html" id="imgTpl">
                    <img src="{{d.avatar}}" height="42">
                </script>

                <script type="text/html" id="barLists">
                    <!--<a class="layui-btn layui-btn-sm" href="{:url('lookUser')}?id={{d.id}}"><i class="layui-icon layui-icon-list"></i>查看</a>-->
                    <!--<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="delete"><i class="layui-icon layui-icon-delete"></i>删除</a>-->
                </script>
            </div>
        </div>
    </div>
</div>
<include file="public@scripts"/>
<script>
    var table = layui.table;
    table.render({
        elem: '#lists',
        even: true,
        id: 'listsReload',
        url: "{:url('getUsers')}",
        cols: [[
            {field: 'id', title: 'ID', align: 'center', width: 80}
            , {field: 'username', title: '账户名', width: 300}
            , {field: 'nick_name', title: '昵称', width: 150}
            , {field: 'avatar', title: '头像', templet: '#imgTpl', width: 80}
            , {field: 'mobile', title: '电话', width: 120}
            , {field: 'email', title: '邮箱', width: 120}
            , {field: 'create_time', title: '注册时间', width: 180}
//					, { fixed: 'right', title: '操作', align: 'center',width:250, toolbar: '#barLists' }
        ]],
        page: true
    });

    var active = {
        reload: function () {
            var mobile = $('input[name="mobile"]').val();

            table.reload('listsReload', {
                where: {
                    key: {
                        mobile: mobile
                    }
                }
            });
        }
    };

    $('.listsTable .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
</script>
</body>

</html>
